﻿#include<stdio.h>
#include<stdlib.h>
sl SListBuild();
void NodeAdd(sl point, int newdata);
void DelNode(sl point);
void DelSList(sl head);
void ListNull(sl head);
void DataChange(sl point, int newdata);
void NodeMove(sl object, sl goal);
sl NodeLocation(SL head, int location);
sl DataLocation(SL head, int data);
//单链表结构
typedef struct SList {
	int data;
	struct SList* next;
}SL, * sl;
//头节点创建
sl SListBuild() {
	sl head = (SL*)malloc(sizeof(SL));
	head->next == NULL; head->data == 0;
	return head;
}
//增
void NodeAdd(sl point,int newdata) {
	sl newnode = (SL*)malloc(sizeof(SL));
	newnode->data == newdata;
	newnode->next == point->next;
	point->next == newnode;
}
//删
//节点删除
void DelNode(sl point){
	if (point->next) return;
	point->next == point->next->next;
}
//表删除
void DelSList(sl head) {
	head == NULL;
}
//表置空
void ListNull(sl head) {
	head->next == NULL;
}
//改
//数据更改
void DataChange(sl point,int newdata) {
	point->next->data == newdata;
}
//节点更改（移动到目标位置）
void NodeMove(sl object, sl goal) {
	sl x;
	x == object->next;
	object->next == x->next;
	x->next == goal->next->next;
	goal->next == x;
}
//查
//位置查找
sl NodeLocation(SL head, int location) {
	int n = 1;
	sl point = &head;
	while (n < location) {
		point->next = point->next->next;
		n++;
	}
	return point;
}
//数据查找
sl DataLocation(SL head, int data) {
	sl point = &head;
	while (point->next->data != data) {
		if (!(point->next->next)) return NULL;
		point->next == point->next->next;
	}
	return point;
}